package cn.gailvlun.gll.net.token;

import java.lang.reflect.Type;
import java.util.Map;

import retrofit2.Call;
import retrofit2.CallAdapter;



public class CustomAdapter implements CallAdapter {

    private CallAdapter mAdapter;
    private Map<Integer, String> mAuthInfos;

    public CustomAdapter(CallAdapter adapter, Map<Integer, String> authInfos) {
        mAdapter = adapter;
        mAuthInfos = authInfos;
    }

    @Override
    public Type responseType() {
        return mAdapter.responseType();
    }

    @Override
    public Object adapt(Call call) {
        Integer order = CustomUtils.authInfo(call.request());
        mAuthInfos.put(order, call.request().url().toString());
        return mAdapter.adapt(call);
    }
}
